const infocontentUrl = require('../../../../config').infocontentUrl;
var WxParse = require('../../../../wxParse/wxParse.js');
// var httpRootPath = 'https://www.yn-etc.com/yn_portal_api';
Page({
    data: {
        newsDetail: {},
        warnInfo: "图片无法显示"
    },
    onLoad: function (options) {
        var id = options.id
        var that = this
        wx.showToast({
            title: '加载中',
            icon: 'loading',
            duration: 1500
        })
        wx.request({
            url: infocontentUrl + id,
            data: {},
            method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
            // header: {}, // 设置请求的 header
            success: function (res) {
                console.log("获取到详情页");
                var status = res.data.status;
                var newsDetail = res.data.data.object
                if (status == '0') {
                    WxParse.wxParse('insertData', 'html', newsDetail.content, that);
                    that.setData({
                        newsDetail: newsDetail
                    })
                } else {
                    that.setData({
                        newsDetail: '获取失败'
                    })
                }
                // success
            },
            fail: function () {
                // fail
            },
            complete: function () {
                // complete
            }
        })
    }
})